You may have seen my blog post on how to add all of the assemblies from a folder into the GAC. Here is a quick PowerShell script to do the reverse – it looks through a list of assemblies in a folder and removes them from the GAC:
$gacUtilLocation = “C:Program Files (x86)Microsoft SDKsWindowsv7.0ABinx64gacutil.exe”;
get-childitem * -include *.dll,*.exe | foreach-object {
Write-Host “Removing” $asm.FullName
$asm = [System.Reflection.Assembly]::LoadFile($_)
$command = “&`”{0}`”/nologo /u `”{1}`”” -f $gacUtilLocation,$asm.FullName
invoke-expression $command
}
I find this helpful in SharePoint to make sure the GAC is clear of any of my development assemblies before doing a proper deployment from a WSP.
Load comments